﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace Bitter.Win.Controls
{
    public partial class LogonControl : UserControl
    {
        [DefaultValue("Account:")]
        public string AccountTitle
        {
            get { return AddressText.Text; }
            set { AddressText.Text = value; }
        }

        public LogonControl()
        {
            InitializeComponent();
        }

        private void Cancel_Click(object sender, EventArgs e)
        {
            Address.Text = string.Empty;
            Password.Text = string.Empty;

            RememberMe.Checked = false;
            RememberPassword.Checked = false;
            SignInAutomatically.Checked = false;
        }

        public delegate void SigningInHandler(LogonControl sender, string username, string password);

        public event SigningInHandler SigningIn;

        public virtual void OnSigningIn()
        {
            if (SigningIn != null)
            {
                SigningIn(this, Address.Text, Password.Text);
            }
        }

        private void SignIn_Click(object sender, EventArgs e)
        {
            OnSigningIn();
        }
    }
}
